package com.hnx.admin.aurora.security.api;

import com.hnx.admin.aurora.api.cache.CacheAPI;
import org.apache.commons.lang3.StringUtils;

import java.util.Set;

public interface PermissionValidator extends CacheAPI {
    boolean hasPermi(String permission);
    /**
     * 判断是否包含权限
     *
     * @param permissions 权限列表
     * @param permission 权限字符串
     * @return 用户是否具备某权限
     */
    default boolean hasPermissions(Set<String> permissions, String permission)
    {
        return permissions.contains(ALL_PERMISSION) || permissions.contains(StringUtils.trim(permission));
    }
}
